package com.fitzone.web.controller.mini;

import com.fitzone.common.result.Result;
import com.fitzone.model.dto.CoachMiniDTO;
import com.fitzone.model.dto.CourseMiniDTO;
import com.fitzone.model.vo.CoachMiniVO;
import com.fitzone.model.vo.CoachVO;
import com.fitzone.model.vo.CourseMiniInfoVO;
import com.fitzone.model.vo.CourseMiniVO;
import com.fitzone.web.service.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/mini/course")
@Api(tags =  "小程序-课程相关接口")
public class MiniCourseController {
    private final CourseService courseService;

    /**
     * 课程详情
     * @param courseId
     * @return
     */
    @ApiOperation("小程序-课程详情")
    @GetMapping("/info/{courseId}")
    public Result<CourseMiniInfoVO> courseInfo(@PathVariable Long courseId){
        return Result.ok(courseService.courseInfoById(courseId));
    }

    /**
     * 课程列表
     * @param courseMiniDTO
     * @return
     */
    @ApiOperation("小程序-课程列表")
    @GetMapping("/list")
    public Result<List<CourseMiniVO>> courseList(CourseMiniDTO courseMiniDTO){
        return Result.ok(courseService.courseList(courseMiniDTO));
    }
}
